package com.example.xwen.activitylifecycle;

import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    private Button bt;
    private static final String LIFE_TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.v(MainActivity.LIFE_TAG,"FirstActivity---->onCreate");
        bt = (Button) findViewById(R.id.button);
        bt.setOnClickListener(new ButtonOnClickListener());
    }
    class ButtonOnClickListener implements View.OnClickListener{
        @Override
        public void onClick(View v){
            Intent intent = new Intent();
            intent.setClass(MainActivity.this,Main2Activity.class);
            MainActivity.this.startActivity(intent);
        }
    }
    @Override
    protected void onStart(){
        Log.v(MainActivity.LIFE_TAG,"FirstActivity---->onStart");
        super.onStart();
    }
    @Override
    protected void onResume(){
        Log.v(MainActivity.LIFE_TAG,"FirstActivity---->onResume");
        super.onResume();
    }
    @Override
    protected void onPause(){
        Log.v(MainActivity.LIFE_TAG,"FirstActivity---->onPause");
        super.onPause();
    }
    @Override
    protected void onStop(){
        Log.v(MainActivity.LIFE_TAG,"FirstActivity---->onStop");
        super.onStop();
    }
    @Override
    protected void onDestroy(){
        Log.v(MainActivity.LIFE_TAG,"FirstActivity---->onDestroy");
        super.onDestroy();
    }
    @Override
    protected void onRestart(){
        Log.v(MainActivity.LIFE_TAG,"FirstActivity---->onRestart");
        super.onRestart();
    }


}
